/**
* Created by wust on 2020-12-03 11:14:47.
*/
<template>
  <div>
    <el-button-group style="margin-bottom: 5px;">
      <el-button size="mini" type="primary" v-file-download-directive="'post_template.xls'">下载模版</el-button>
    </el-button-group>
    <el-form label-width="120px" @submit.native.prevent>
      <file-upload-component :src="uploadUrl" :fileType="'xls,xlsx'" :fileSize="10" :fileNumber="1" v-on:importCallback="importCallback"></file-upload-component>
    </el-form>
  </div>
</template>
<script>
  import Vue from 'vue'
  import FileUploadComponent from '@/common/component/file-upload-component.vue'
  export default {
    name: 'post-import',
    components: {
      FileUploadComponent
    },
    data() {
      return {
        uploadUrl: Vue.$adminServerURL + '/web/v1/PostController/importByExcel?xmlName=admin_server_post'
      }
    },
    methods: {
      importCallback: function(e) { // 回调
        this.$confirm('导入完成，需要跳转到结果页面吗？', '询问', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$router.push({
            path: '/MyImportExportList'
          })
        }).catch(() => {})
      }
    }
  }
</script>
